<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>wgpluck</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="wgflute.html" title="wgflute" />
    <link rel="next" href="wgpluck2.html" title="wgpluck2" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">wgpluck</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="wgflute.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="wgpluck2.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="wgpluck"></a>
      <div class="titlepage"></div>
      <a id="IndexWgpluck" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">wgpluck</span>
        </h2>
        <p>wgpluck — 
      A high fidelity simulation of a plucked string.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp167935776"></a>
        <h2>Description</h2>
        <p>
      A high fidelity simulation of a plucked string, using interpolating delay-lines.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp167937072"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>wgpluck</strong></span> icps, iamp, kpick, iplk, idamp, ifilt, axcite</pre>
      </div>
      <div class="refsect1">
        <a id="idp168008736"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>icps</em></span> -- frequency of plucked string
    </p>
        <p>
      <span class="emphasis"><em>iamp</em></span> -- amplitude of string pluck
    </p>
        <p>
      <span class="emphasis"><em>iplk</em></span> -- point along the string, where it is plucked, in the range of 0 to 1. 0 = no pluck
    </p>
        <p>
      <span class="emphasis"><em>idamp</em></span> -- damping of the note. This controls the overall decay of the string. The greater the value of <span class="emphasis"><em>idamp</em></span>, the faster the decay. Negative values will cause an increase in output over time.
    </p>
        <p>
      <span class="emphasis"><em>ifilt</em></span> -- control the attenuation of the filter at the bridge. Higher values cause the higher harmonics to decay faster.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168014464"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kpick</em></span> -- proportion of the way along the point to sample the output.
    </p>
        <p>
      <span class="emphasis"><em>axcite</em></span> -- a signal which excites the string.
    </p>
        <p>
      A string of frequency <span class="emphasis"><em>icps</em></span> is plucked with
      amplitude <span class="emphasis"><em>iamp</em></span> at
      point <span class="emphasis"><em>iplk</em></span>. The decay of the virtual string
      is controlled by <span class="emphasis"><em>idamp</em></span>
      and <span class="emphasis"><em>ifilt</em></span> which simulate the bridge. The
      oscillation is sampled at the point <span class="emphasis"><em>kpick</em></span>,
      and excited by the signal <span class="emphasis"><em>axcite</em></span>. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168020720"></a>
        <h2>Examples</h2>
        <p>
      The following example produces a moderately long note with
      rapidly decaying upper partials. It uses the
      file <a class="ulink" href="examples/wgpluck.csd" target="_top"><em class="citetitle">wgpluck.csd</em></a>. 

      </p>
        <div class="example">
          <a id="idp168022640"></a>
          <p class="title">
            <strong>Example 1043. An example of the wgpluck opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the
          sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time
          Audio</em></a>
          and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line
          Flags</em></a> for more information on using
          command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o wgpluck.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  icps <span class="op">=</span> 220
  iamp <span class="op">=</span> 20000
  kpick <span class="op">=</span> 0.5
  iplk <span class="op">=</span> 0
  idamp <span class="op">=</span> 10
  ifilt <span class="op">=</span> 1000

  axcite <span class="opc">oscil</span> 1, 1, 1
  apluck <span class="opc">wgpluck</span> icps, iamp, kpick, iplk, idamp, ifilt, axcite

  <span class="opc">out</span> apluck
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Table #1, a sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="comment">; Play Instrument #1 for two seconds.</span>
<span class="stamnt">i</span> 1 0 2
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>
      The following example produces a shorter, brighter note. It uses the file
      <a class="ulink" href="examples/wgpluck_brighter.csd" target="_top"><em class="citetitle">wgpluck_brighter.csd</em></a>. 

      </p>
        <div class="example">
          <a id="idp168028016"></a>
          <p class="title">
            <strong>Example 1044. An example of the wgpluck opcode with a shorter, brighter note.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o wgpluck_brighter.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  icps <span class="op">=</span> 220
  iamp <span class="op">=</span> 20000
  kpick <span class="op">=</span> 0.5
  iplk <span class="op">=</span> 0
  idamp <span class="op">=</span> 30
  ifilt <span class="op">=</span> 10

  axcite <span class="opc">oscil</span> 1, 1, 1
  apluck <span class="opc">wgpluck</span> icps, iamp, kpick, iplk, idamp, ifilt, axcite

  <span class="opc">out</span> apluck
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Table #1, a sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="comment">; Play Instrument #1 for two seconds.</span>
<span class="stamnt">i</span> 1 0 2
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168029968"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Michael A. Casey</td>
          </tr>
          <tr>
            <td>M.I.T.</td>
          </tr>
          <tr>
            <td>Cambridge, Mass.</td>
          </tr>
          <tr>
            <td>1997</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Version 3.47</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="wgflute.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="wgpluck2.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">wgflute </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> wgpluck2</td>
        </tr>
      </table>
    </div>
  </body>
</html>
